package com.unionpay.mpds.model;

// default package

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Bin entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "T_BIN", uniqueConstraints = @UniqueConstraint(columnNames = "BIN_CODE"))
public class Bin implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -5096356007031360587L;
	private String binCode;
	private Integer binLen;
	private Integer binTrack;
	private Integer binOffset;
	private Integer cardLen;
	private Integer cardType;
	private String issuerName;
	private String issuerCode;
	private Integer expOffset;
	private Integer cardOffset;
	private Integer cardLevel;

	// Constructors

	/** default constructor */
	public Bin() {
	}

	/** full constructor */
	public Bin(String binCode, Integer binLen, Integer binTrack,
			Integer binOffset, Integer cardLen, Integer cardType,
			String issuerName, String issuerCode, Integer expOffset,
			Integer cardOffset, Integer cardLevel) {
		this.binCode = binCode;
		this.binLen = binLen;
		this.binTrack = binTrack;
		this.binOffset = binOffset;
		this.cardLen = cardLen;
		this.cardType = cardType;
		this.issuerName = issuerName;
		this.issuerCode = issuerCode;
		this.expOffset = expOffset;
		this.cardOffset = cardOffset;
		this.cardLevel = cardLevel;
	}

	// Property accessors

	@Id
	@Column(name = "BIN_CODE", unique = true, nullable = false, length = 10)
	public String getBinCode() {
		return this.binCode;
	}

	public void setBinCode(String binCode) {
		this.binCode = binCode;
	}

	@Column(name = "BIN_LEN", nullable = false)
	public Integer getBinLen() {
		return this.binLen;
	}

	public void setBinLen(Integer binLen) {
		this.binLen = binLen;
	}

	@Column(name = "BIN_TRACK", nullable = false)
	public Integer getBinTrack() {
		return this.binTrack;
	}

	public void setBinTrack(Integer binTrack) {
		this.binTrack = binTrack;
	}

	@Column(name = "BIN_OFFSET", nullable = false)
	public Integer getBinOffset() {
		return this.binOffset;
	}

	public void setBinOffset(Integer binOffset) {
		this.binOffset = binOffset;
	}

	@Column(name = "CARD_LEN", nullable = false)
	public Integer getCardLen() {
		return this.cardLen;
	}

	public void setCardLen(Integer cardLen) {
		this.cardLen = cardLen;
	}

	@Column(name = "CARD_TYPE", nullable = false)
	public Integer getCardType() {
		return this.cardType;
	}

	public void setCardType(Integer cardType) {
		this.cardType = cardType;
	}

	@Column(name = "ISSUER_NAME", nullable = false, length = 20)
	public String getIssuerName() {
		return this.issuerName;
	}

	public void setIssuerName(String issuerName) {
		this.issuerName = issuerName;
	}

	@Column(name = "ISSUER_CODE", nullable = false, length = 8)
	public String getIssuerCode() {
		return this.issuerCode;
	}

	public void setIssuerCode(String issuerCode) {
		this.issuerCode = issuerCode;
	}

	@Column(name = "EXP_OFFSET", nullable = false)
	public Integer getExpOffset() {
		return this.expOffset;
	}

	public void setExpOffset(Integer expOffset) {
		this.expOffset = expOffset;
	}

	@Column(name = "CARD_OFFSET", nullable = false)
	public Integer getCardOffset() {
		return this.cardOffset;
	}

	public void setCardOffset(Integer cardOffset) {
		this.cardOffset = cardOffset;
	}

	@Column(name = "CARD_LEVEL", nullable = false)
	public Integer getCardLevel() {
		return this.cardLevel;
	}

	public void setCardLevel(Integer cardLevel) {
		this.cardLevel = cardLevel;
	}

	public boolean equals(Object other) {
		if ((this == other))
			return true;
		if ((other == null))
			return false;
		if (!(other instanceof Bin))
			return false;
		Bin castOther = (Bin) other;

		return ((this.getBinCode() == castOther.getBinCode()) || (this
				.getBinCode() != null && castOther.getBinCode() != null && this
				.getBinCode().equals(castOther.getBinCode())))
				&& ((this.getBinLen() == castOther.getBinLen()) || (this
						.getBinLen() != null && castOther.getBinLen() != null && this
						.getBinLen().equals(castOther.getBinLen())))
				&& ((this.getBinTrack() == castOther.getBinTrack()) || (this
						.getBinTrack() != null
						&& castOther.getBinTrack() != null && this
						.getBinTrack().equals(castOther.getBinTrack())))
				&& ((this.getBinOffset() == castOther.getBinOffset()) || (this
						.getBinOffset() != null
						&& castOther.getBinOffset() != null && this
						.getBinOffset().equals(castOther.getBinOffset())))
				&& ((this.getCardLen() == castOther.getCardLen()) || (this
						.getCardLen() != null && castOther.getCardLen() != null && this
						.getCardLen().equals(castOther.getCardLen())))
				&& ((this.getCardType() == castOther.getCardType()) || (this
						.getCardType() != null
						&& castOther.getCardType() != null && this
						.getCardType().equals(castOther.getCardType())))
				&& ((this.getIssuerName() == castOther.getIssuerName()) || (this
						.getIssuerName() != null
						&& castOther.getIssuerName() != null && this
						.getIssuerName().equals(castOther.getIssuerName())))
				&& ((this.getIssuerCode() == castOther.getIssuerCode()) || (this
						.getIssuerCode() != null
						&& castOther.getIssuerCode() != null && this
						.getIssuerCode().equals(castOther.getIssuerCode())))
				&& ((this.getExpOffset() == castOther.getExpOffset()) || (this
						.getExpOffset() != null
						&& castOther.getExpOffset() != null && this
						.getExpOffset().equals(castOther.getExpOffset())))
				&& ((this.getCardOffset() == castOther.getCardOffset()) || (this
						.getCardOffset() != null
						&& castOther.getCardOffset() != null && this
						.getCardOffset().equals(castOther.getCardOffset())))
				&& ((this.getCardLevel() == castOther.getCardLevel()) || (this
						.getCardLevel() != null
						&& castOther.getCardLevel() != null && this
						.getCardLevel().equals(castOther.getCardLevel())));
	}

	public int hashCode() {
		int result = 17;

		result = 37 * result
				+ (getBinCode() == null ? 0 : this.getBinCode().hashCode());
		result = 37 * result
				+ (getBinLen() == null ? 0 : this.getBinLen().hashCode());
		result = 37 * result
				+ (getBinTrack() == null ? 0 : this.getBinTrack().hashCode());
		result = 37 * result
				+ (getBinOffset() == null ? 0 : this.getBinOffset().hashCode());
		result = 37 * result
				+ (getCardLen() == null ? 0 : this.getCardLen().hashCode());
		result = 37 * result
				+ (getCardType() == null ? 0 : this.getCardType().hashCode());
		result = 37
				* result
				+ (getIssuerName() == null ? 0 : this.getIssuerName()
						.hashCode());
		result = 37
				* result
				+ (getIssuerCode() == null ? 0 : this.getIssuerCode()
						.hashCode());
		result = 37 * result
				+ (getExpOffset() == null ? 0 : this.getExpOffset().hashCode());
		result = 37
				* result
				+ (getCardOffset() == null ? 0 : this.getCardOffset()
						.hashCode());
		result = 37 * result
				+ (getCardLevel() == null ? 0 : this.getCardLevel().hashCode());
		return result;
	}

}